﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FundamentalsOfCompiling
{
   public class SourceString:ISource
    {
        int i = 0;
        private string str;
       
        public  SourceString(string s) { this.str = s; i = 0; }
        int ISource.getNextChar()
        {
            if (i < str.Length) { return str[i++];}
            return -1;
        }
        void ISource.ungetNextChar()
        {
            i--;
           // return i;
        }
        void ISource.close() { str = null; }
        public int getI() { return i; }
    }
}
